import React, { useState } from "react";
interface ChildrenProps {
  num: number;
}
interface DemoProps {
  children(props: ChildrenProps): JSX.Element;
}

const Demo = (props: DemoProps) => {
  const [num] = useState(0);
  return props.children({ num });
};

const TestDemo = () => {
  return <Demo>{({ num }) => <div>12312312{num}</div>}</Demo>;
};
export default TestDemo;
